package nl.fotoniq.android.lockpicker.shared;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

/**
 * The Class LockPickerStartupReceiver.
 * <p>
 * This class runs {@link LockPickerService} on device startup, if applicable
 * </p>
 * 
 * @author jeroen.brosens
 */
public class LockPickerStartupReceiver extends BroadcastReceiver {

	/**
	 * {@inheritDoc}
	 * 
	 * @see android.content.BroadcastReceiver#onReceive(android.content.Context, android.content.Intent)
	 */
	@Override
	public void onReceive(Context context, Intent intent) {
		if (LockPickerUtil.isServiceExpectedToStart(context)) {
			context.startService(new Intent(context, LockPickerService.class));

			LockPickerUtil.log_d("LockPicker service started");
		} else {
			LockPickerUtil.log_d("LockPicker not set to run on startup");
		}
	}
}
